package castledefense.game.render;

import castledefense.data.GameData;
import castledefense.game.render.effects.DebuffHandler;
import castledefense.logic.Targetable;

import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class RenderDebuff {
	
	private DebuffHandler fireDotHandler;
	private DebuffHandler stunHandler;
	private DebuffHandler slowHandler;
	
	public RenderDebuff(){
		fireDotHandler = new DebuffHandler(GameData.fire);
		stunHandler = new DebuffHandler(GameData.earth);
		slowHandler = new DebuffHandler(GameData.water);
	}

	public void dispose() {
		fireDotHandler.dispose();
		stunHandler.dispose();
		slowHandler.dispose();
	}

	public void render(SpriteBatch spriteBatch, float delta) {
		fireDotHandler.render(spriteBatch, delta);
		stunHandler.render(spriteBatch, delta);
		slowHandler.render(spriteBatch, delta);
	}

	public void update(int delta) {
		fireDotHandler.update(delta);
		stunHandler.update(delta);
		slowHandler.update(delta);
	}

	public void addBlast(Targetable target, int duration, int type) {
		if(type == GameData.fire){
			fireDotHandler.addBlast(target, duration);
		}else if(type == GameData.water){
			slowHandler.addBlast(target, duration);
		}else if(type == GameData.earth){
			stunHandler.addBlast(target, duration);
		}
	}
	
}


